var input_1= document.getElementById("show-0");
var schoolSelect = document.getElementById("schoolSelect");
var area=document.getElementById("province")
var univer=document.getElementById("univer")
var school="";
//鼠标移入
input_1.onmouseover = function() {
    schoolSelect.style.display = 'block';
    input_1.getElementsByTagName("input")[0].style.borderRadius="15px 15px 0px 0px";
    input_1.getElementsByTagName("input")[0].style.borderBottom="0px";
    input_1.getElementsByTagName("input")[0].style.backgroundColor="#fdfdfd";
}
//鼠标移出
input_1.onmouseout = function() {
    schoolSelect.style.display = 'none';
    input_1.getElementsByTagName("input")[0].style.borderRadius="15px";
    input_1.getElementsByTagName("input")[0].style.borderBottom="1px solid #ccc";
    input_1.getElementsByTagName("input")[0].style.backgroundColor="#eee"
}
let arr={
    "北京":["北京工业大学","清华大学","中国人民大学","北京大学","北京交通大学","北京理工大学","北京科技大学","北方工业大学","北京工商大学","北京邮电大学","北京建筑大学","北京农业大学","北京林业大学","北京师范大学","北京语言大学","中国传媒大学","中国财经大学","北京公安大学","北京财经学院","北京体育大学"],
    "上海":["上海戏剧学院","上海海事大学","上海工业大学","上海交通大学","上海理工大学","上海科技大学","上海工商大学","上海邮电大学","上海建筑大学","上海农业大学","上海林业大学","上海师范大学","上海语言大学","中国财经大学","上海公安大学","上海财经学院","上海体育大学"],
    "广州":["广州xx学院","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx大学","广州xx学院","广州xx大学"],
    "重庆":["重庆xx学院","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx大学","重庆xx学院","重庆xx大学"],
    "武汉":["武汉xx学院","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx大学","武汉xx学院","武汉xx大学"],
    "0x省":["xx省xx学院","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx学院","xx省xx大学"],
    "1x省":["xx省xx学院","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx学院","xx省xx大学"],
    "2x省":["xx省xx学院","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx学院","xx省xx大学"],
    "3x省":["xx省xx学院","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx学院","xx省xx大学"],
    "4x省":["xx省xx学院","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx大学","xx省xx学院","xx省xx大学"],

}
//打印省份到页面
for(var x=0;x<Object.keys(arr).length;x++){
    let a=`<span>${Object.keys(arr)[x]}</span>`;
    area.innerHTML+=a;
}

let len_1=province.querySelectorAll("span").length;
for(var i=0;i<len_1;i++){
    province.querySelectorAll("span")[i].onclick=function(){
        for(var i=0;i<len_1;i++){
            province.querySelectorAll("span")[i].style.fontWeight="normal";
            univer.style.display = 'none';
            univer.innerHTML='';//赋值为空
        }
            this.style.fontWeight="bold";
            //点击之后打印学校
            for(var i=0;i<arr[this.innerHTML].length;i++){
                let b=`<span>${arr[this.innerHTML][i]}</span>`;
                univer.innerHTML+=b;
            }
            synchronization();            
            univer.style.display = 'block';        
    }
}
//学校点击同步INPUT框,封装成函数
let synchronization=function(){
    let len_2=univer.querySelectorAll("span").length;
        for(var i=0;i<len_2;i++){
            univer.querySelectorAll("span")[i].onclick=function(){
                for(var i=0;i<len_2;i++){
                    univer.querySelectorAll("span")[i].style.fontWeight="normal"; 
                }
            this.style.fontWeight="bold";
            input_1.getElementsByTagName("input")[0].value=this.innerHTML;
            school=this.innerHTML;     
    }
}
}



